﻿using System.Collections;
using System.Collections.Generic;
using FairyGUI;
using UnityEngine;

public class MyWindow : Window
{
    Transition _winAni;
    protected override void OnInit()
    {
 	    base.OnInit();
        this.Center();//居中
    }
    /// <summary>
    /// 做隐藏面板动画
    /// </summary>
    protected override void DoHideAnimation()
    {
        if(_winAni != null) _winAni.PlayReverse(() => { base.DoHideAnimation(); });
        else base.DoHideAnimation();
    }
    /// <summary>
    /// 做显示面板动画操作
    /// </summary>
    protected override void DoShowAnimation()
    {
        base.DoShowAnimation();
        this.Center();//居中
        if(_winAni == null) _winAni = this.contentPane.GetTransition("winAni");
        if(_winAni != null) _winAni.Play();
    }
    /// <summary>
    /// 设置是否可拖拽
    /// </summary>
    /// <param name="enable"></param>
    public virtual void SetDragable(bool enable){
        var frame = this.contentPane.GetChild("frame");
        if(frame != null) frame.touchable = enable;
    }
}
